package com.com.apitools.ui.component;

import javax.swing.table.DefaultTableModel;
import java.util.Vector;

/**
 * ***************************************************************
 * <p/>
 * <pre>
 * Copyright (c) 2014 –苏州犀牛网络科技有限公司
 *  Title: com.com.apitools.ui.component
 *  Description:
 * ***************************************************************
 *  11/4 0004  V1.0  xiniu    New Files for com.com.apitools.ui.component
 * </pre>
 */
public class CheckTableModle extends DefaultTableModel {
    public CheckTableModle(Vector data, Vector columnNames) {
        super(data, columnNames);
    }

    @Override
    public boolean isCellEditable(int row, int column) {
        return column==0;
    }

    public void addData(Vector data){
        this.addRow(data);
    }
    // /**
    // * 根据类型返回显示空间
    // * 布尔类型返回显示checkbox
    // */
    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }

    public void selectAllOrNull(boolean value) {
        int rowcount = getRowCount();
        for (int i = 0; i < rowcount; i++) {
            this.setValueAt(value, i, 0);
        }
    }
}
